import request from '@/utils/request'
import { get } from '@/utils/storage'

export function add({ project_name, productid, spaceid, systemid, client_type, refsystemid, axure, preview, api, password, user, nodejs }) {
  return request({
    url: 'projects/add',
    method: 'post',
    data: {
      project_name,
      productid,
      spaceid,
      systemid,
      client_type,
      refsystemid,
      axure,
      preview,
      api,
      nodejs,
      password,
      user
    }
  })
}

export function find_list() {
  return request({
    url: 'projects',
    method: 'post',
    data: {}
  })
}

export function project_del(project_id) {
  return request({
    url: 'projects/del',
    method: 'post',
    data: {
      project_id
    }
  })
}

// 新增分类
export function add_classify_service(project_id, spaceid, type, doc_title) {
  return request({
    url: 'docs/add_classify',
    method: 'post',
    data: {
      project_id,
      spaceid,
      type,
      doc_parent_id: 'root',
      doc_title,
      editer: get('user_code')
    }
  })
}
